<?php
	include_once("king_head.php");	
	include_once("ClsSebent//Content_class.php");	
	
	$page_option=new Content_class();
	

	if(!$_SESSION['SITE_ID'])
	{	
		?>
			<script> location.replace("index.php"); </script>
		<?php
	}
	


?>
		<link href="wis.css" rel="stylesheet" type="text/css" />
		<form id="form1" name="form1" method="post" action="page_content.php">	
<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tr>
    <td height="40" valign="middle" class="wisbig"><div align="center" class="wisheading_green">These Pages  updated</div></td>
  </tr>
</table>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr class="tablefirstrow">
    <td>SN</td>
    <td>Page Title </td>
    <td>Date</td>
  </tr>
  
  <?php
  	$query=" select * from  `reseller_page_add`  where `site_id`='".$_SESSION['SITE_ID']."'  AND `update`='' ";
	
	$result=mysql_query($query);
		
	$i=1;
	//echo $query;		
	while($line=mysql_fetch_array($result,MYSQL_ASSOC))
	{
					
  
	  ?>
	  <tr class="wis">
		<td><?php echo $i; ?></td>
		<td><?php echo $page_option->get_data('site_page',$line['page_id'],'page_title'); ?></td>
		<td><?php echo $line['datetime']; ?></td>
  </tr>
	   <?php
	   
	   // update pages
	   
	   $query_site_page="select * from `site_page` where `id`='".$line['page_id']."' ";
	   
	   $result_site_page=mysql_query($query_site_page);
	   
	   $line_site_page=mysql_fetch_array($result_site_page,MYSQL_ASSOC);
	   
	   //`` , `` , `` , `` , `` , `` , `` , `` , `` , `` , `` , `` ) VALUES ( NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , '', '', '', 'Y', 'N', 'Y' );
	   
		$query_site_page_insert=" INSERT INTO `site_page` ( `id` , `site_id` , `page_title` , `page_content` , `page_content_img` , `page_content_img_alt` , `page_content_ic` , `banner` , `banner_link` , `meta_keywords` , `meta_description` , `meta_title` , `page_update` , `admin_pg` ,`parent_pageid`, `u_pagemeta` ) VALUES (NULL,'".$_SESSION['SITE_ID']."' ";
		
		$query_site_page_insert.=" ,'".$line_site_page['page_title']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['page_content']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['page_content_img']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['page_content_img_alt']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['page_content_ic']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['banner']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['banner_link']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['meta_keywords']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['meta_description']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['meta_title']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['page_update']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['admin_pg']."' ";
		$query_site_page_insert.=" ,'".$line['page_id']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['u_pagemeta']."' ) ";
		
		mysql_query($query_site_page_insert);
		
		if(mysql_error())
		{
			echo "<br>".mysql_error();
		}
		else
		{
			$query=" update  `reseller_page_add`  set   `update`='Y'  where `id`='".$line['id']."' ";
	
			$result=mysql_query($query);
			if(mysql_error())
			{
				echo "<br>".mysql_error();
			}
		}

		
	   $i++;
	  }



	  $query=" select * from  `reseller_page_add`  where `site_id`='".$_SESSION['SITE_ID']."'  AND `update`='U' ";
	
	$result=mysql_query($query);
		
	$i=1;
	//echo $query;		
	while($line=mysql_fetch_array($result,MYSQL_ASSOC))
	{
					
  
	  ?>
	  <tr class="wis">
		<td><?php echo $i; ?></td>
		<td><?php echo $page_option->get_data('site_page',$line['page_id'],'page_title'); ?></td>
		<td><?php echo $line['datetime']; ?></td>
  </tr>
	   <?php
	   
	   // update pages
	   
	   $query_site_page=" select * from `site_page` where `id`='".$line['page_id']."' ";
	   
	   $result_site_page=mysql_query($query_site_page);
	   
	   $line_site_page=mysql_fetch_array($result_site_page,MYSQL_ASSOC);
	   
	   //`` , `` , `` , `` , `` , `` , `` , `` , `` , `` , `` , `` ) VALUES ( NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , '', '', '', 'Y', 'N', 'Y' );
	   
		/*$query_site_page_insert=" INSERT INTO `site_page` ( `id` , `site_id` , `page_title` , `page_content` , `page_content_img` , `page_content_img_alt` , `page_content_ic` , `banner` , `banner_link` , `meta_keywords` , `meta_description` , `meta_title` , `page_update` , `admin_pg` , `u_pagemeta` ) VALUES (NULL,'".$_SESSION['SITE_ID']."' ";
		
		$query_site_page_insert.=" ,'".$line_site_page['page_title']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['page_content']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['page_content_img']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['page_content_img_alt']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['page_content_ic']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['banner']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['banner_link']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['meta_keywords']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['meta_description']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['meta_title']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['page_update']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['admin_pg']."' ";
		$query_site_page_insert.=" ,'".$line_site_page['u_pagemeta']."' ) ";
*/

		$query_site_page_insert=" update `site_page` set ";
		
		$query_site_page_insert.=" page_title='".$line_site_page['page_title']."', ";
		$query_site_page_insert.=" page_content='".$line_site_page['page_content']."', ";
		$query_site_page_insert.=" page_content_img='".$line_site_page['page_content_img']."', ";
		$query_site_page_insert.=" page_content_img_alt='".$line_site_page['page_content_img_alt']."', ";
		$query_site_page_insert.=" page_content_ic='".$line_site_page['page_content_ic']."', ";
		$query_site_page_insert.=" banner='".$line_site_page['banner']."', ";
		$query_site_page_insert.=" banner_link='".$line_site_page['banner_link']."', ";
		$query_site_page_insert.=" meta_keywords='".$line_site_page['meta_keywords']."', ";
		$query_site_page_insert.=" meta_description='".$line_site_page['meta_description']."', ";
		$query_site_page_insert.=" meta_title='".$line_site_page['meta_title']."', ";
		$query_site_page_insert.=" page_update='".$line_site_page['page_update']."', ";
		$query_site_page_insert.=" admin_pg='".$line_site_page['admin_pg']."', ";
		$query_site_page_insert.=" u_pagemeta='".$line_site_page['u_pagemeta']."' ";
		$query_site_page_insert.=" where parent_pageid='".$line['page_id']."' and site_id='".$_SESSION['SITE_ID']."'";

	
		mysql_query($query_site_page_insert);
		
		if(mysql_error())
		{
			echo "<br>".mysql_error();
		}
		else
		{
			$query=" update  `reseller_page_add`  set   `update`='Y'  where `id`='".$line['id']."' ";
	
			$result=mysql_query($query);
			if(mysql_error())
			{
				echo "<br>".mysql_error();
			}
		}

		
	   $i++;
	  }
  
  ?>
  <tr>
    <td>&nbsp;</td>
    <td><label>
      <div align="center">
        <input type="submit" name="Submit" value=" OK " />
        </div>
    </label>    <div align="center"></div></td>
    <td>&nbsp;</td>
  </tr>
</table>
 </form>
